<#include "/WEB-INF/common/header.ftl"/>
<script type="text/javascript">
	var pathToImages = '${brandingStaticLocation?default("")}/default/classic/image/calendar/';
	var showCheckbox = false;
	
	
	function save() {
		clearAllInputItem();
		if (saveCheck()) {
			$("thisForm").submit();
		}
	}
	
	function saveCheck() {
		if ($F("name") == "") {
			addInputErrorMessage($("name"), "请填写任务名称！");
			return false;
		} else {
			clearInputState($("name"));
		}
		
		if ($F("description").trim() == "") {
			addInputErrorMessage($("description"), "请填写任务描述！");
			return false;
		}
		return true;
	}
</script>
<@taskMacro.showBrandingStyle "dhtmlgoodies_calendar.css"/>
<@taskMacro.showBrandingJs "dhtmlgoodies_calendar.js"/>
<@taskMacro.showBrandingJs "tipsutil.js"/>
<script type="text/javascript" src="${base}/static/js/fileutil.js"></script>
<div class="Main">
  <div class="Main_fix">
    <#include "/WEB-INF/common/side.ftl"/>
    <div class="Main_body" id="Main_body">
      <div class="Main_locationBar">
        <div class="Main_locationBar_head"></div>
        
        <div class="Main_locationBar_body"><span id="CurrentPosition">任务管理 -> 新增</span>
		</div>
        <div class="Main_locationBar_foot"></div>
      </div>
      <div class="Main_bodyEditBar">
		<div class="Main_bodyEditBar_head"><span>新任务</span></div>
		<@opMacro.showActionResultMsg isSuccess=opResult/>
        <div class="Main_bodyEditBar_body">
          <form id="thisForm" method="post" action="${base}/task/edit.action?menuname=${menuname?if_exists}"  enctype = "multipart/form-data"> 
          <input type="hidden" name="taskId" value="${taskId?if_exists}"/>
          <table width="100%" border="0" cellpadding="0" cellspacing="1" class="editTable">
            <tbody>
              <tr>
                <td class="title">任务名称<em>*</em></td>
                <td class="content2">
                	<input type="text" class="input" name="task.name" id="name" value="${(task.name)?if_exists}"/>
                </td>
			  </tr>
			  
			  <tr>
                <td class="title">优先级<em>*</em></td>
                <td class="content2">
                	<@taskMacro.prioritySel selId="priority" selName="task.priority" selValue= (task.priority)!3/>
                </td>
			  </tr>
			  <tr>
			  	<td class="title">任务描述<em>*</em></td>
                <td class="content2">
                	<textarea class="textarea_middle2" name="task.description" id="description" >${(task.name)?if_exists}</textarea>
                	
                </td>
			  </tr>
			  <tr>
                <td class="title">上传文档</td>
                <td class="content"> 
                	<#if task.taskFileList?exists>
                		<#list task.taskFileList as taskFile>
                			${(taskFile.fileName)?if_exists} <a href="${base}/task/delfile.action?taskFileId=${taskFile.id}&taskId=${taskId}&menuname=${menuname?if_exists}">删除</a> <br>
                		</#list>
                	</#if>
                	<span id="files">
                		
                	</span>
                	<br>
                  	<input type="button" class="button" onclick="addComponent()" value="新增上传文档"/> &nbsp;
                </td>
			  </tr>
			  <tr>
                <td class="title">指派给<em>*</em></td>
                <td class="content"> 
                  	<@taskMacro.userSelect selId="appoint" selName="task.receiveUser.id" userList=userList selectedId=(task.receiveUser.id)!0 showDefault=false/>
                </td>
			  </tr>
			  <tr>
                <td class="title">计划完成时间</td>
                <td class="content"> 
                  	<input type="text" value="<#if (task.planEndTime)??>${task.planEndTime?string("yyyy-MM-dd")}</#if>" class="input_calendar" onclick="displayCalendar('zh_cn',$('planEndTime'),'yyyy-mm-dd',this)" id="planEndTime" name="task.planEndTime" readonly/>
                </td>
			  </tr>
            </tbody>
          </table>
          </form>
		</div>
        <div class="Main_bodyEditBar_foot"></div>
      </div>
      <div class="Main_buttonGroupBar">
        <div class="Main_buttonGroupBar_head"></div>
        
        <div class="Main_buttonGroupBar_body">
          <input type="button" class="button" value="保存" onclick="save();"/> 
          <#--
          <input type="button" class="button" value="返回" onclick="location.href='${base}/detail.action?menuname=${menuname?if_exists}&sessionFlag=true'"/>
        	-->
        </div>
        
        <div class="Main_buttonGroupBar_foot"></div>
      </div>
    </div>
  </div>
</div>
<#include "/WEB-INF/common/footer.ftl"/>
<#--
<#include "/template/default/common/common-js.ftl"/>
<#include "/template/default/common/js.ftl"/> -->
